import React, { Component } from 'react'

export default class msgDetail extends Component {
    render() {
        const arr = [
            { id: 1, name: "商品1", detail: "商品1简介" },
            { id: 2, name: "商品2", detail: "商品2简介" },
            { id: 3, name: "商品3", detail: "商品3简介" },
            { id: 4, name: "商品4", detail: "商品4简介" }
        ]
        const {id} = this.props.match.params
        console.log(id);
        
        const obj = arr.find((item) => item.id === id*1)
        return (
            <div>
                <ul>
                    <li>id: {obj.id}</li>
                    <li>name: {obj.name}</li>
                    <li>detail: {obj.detail}</li>
                </ul>
            </div>
        )
    }
}
